package com.xja.boot.demo.controller;


import com.xja.boot.demo.entity.StudentInfo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;



@RestController
@RequestMapping("demo")
public class DemoController {
    @Autowired
    private StudentInfo studentInfo;
    private Logger logger= LoggerFactory.getLogger(DemoController.class);
    @RequestMapping("nameList")
    public List<String> getNameList(){
        try {
            logger.info("调用了getNameLIst方法");
            List<String> nameList = new ArrayList<>();
            nameList.add("赵丽丽");
            nameList.add("马小跳");
            nameList.add("舒克");
            return nameList;
        }catch (Exception e){
            logger.error("调用了getNameLIst方法异常",e);
        }
        return null;

    }

    @RequestMapping("info")
    public StudentInfo info(){
        System.out.println("利用yml定义了对象");
        return studentInfo;
    }
}
